<template>
    <div>
        <el-form  :inline="true" :model="formInline" style="text-align: left;" class="demo-form-inline">
            <el-form-item label="搜索题库名称">
                <el-input v-model="formInline.user" placeholder="搜索题库名称"></el-input>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="onSubmit">查询</el-button>
            </el-form-item>
        </el-form>
        <div class="table-box">
            <el-table
                    border
                    :data="examTable"
                    style="width: 100%;"
                    :default-sort = "{prop: 'date', order: 'descending'}"
            >
                <el-table-column
                        prop="name"
                        label="题库名称"
                        sortable
                >
                </el-table-column>

                <el-table-column
                        prop="duration"
                        label="题目数量"
                >
                </el-table-column>
                <el-table-column
                        prop="totalScore"
                        label="题目描述"
                >
                </el-table-column>
                <el-table-column
                        prop="startTime"
                        label="创建时间"
                        sortable
                >
                </el-table-column>
                <el-table-column label="操作" >
                    <template slot-scope="scope">
                        <el-button  size="mini"
                                    type="primary"
                                    style="display: table-cell;vertical-align: middle;"
                                    @click="$router.push({name:'ReadyExam',params: scope.row})" >进入考试</el-button>
                    </template>
                </el-table-column>

            </el-table>
        </div>
    </div>

</template>

<script>
    import {examList} from "../../request/api";

    export default {
        created() {
            examList().then(resp=>{
                console.log(resp.data.data);
                let {examList}=resp.data.data
                this.examTable=examList
            })
        },
        data() {
            return {
                formInline: {
                    user: '',
                    region: ''
                },
                examTable:[],
                examTable: [
                    {
                        name:"JAVA基础",
                        // type:"计算机类",
                        startTime:new Date(),
                        duration:"50分钟",
                        totalScore:"100",
                        passLine:"60",

                    },{
                        name:"基础",
                        // type:"计算机类",
                        startTime:new Date(),
                        duration:"60分钟",
                        totalScore:"100",
                        passLine:"60",
                    },
                ]
            }
        },
        methods: {
            goExam(row){
                console.log(row);
            },
            onSubmit() {
                this.$message({
                    message: '此功能尚未开发',
                    type: 'success'
                });
            }
        }
    }
</script>
<style>
</style>